/*
 Copyright (C) 2008  Maurizio Monticelli

 This program is free software; you can redistribute it and/or modify it under the terms of the 
 GNU General Public License as published by the Free Software Foundation; either version 2 of the 
 License, or (at your option) any later version.

 This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 
 even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 
 Public License for more details.

 You should have received a copy of the GNU General Public License along with this program; if not, write 
 to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 
*/

package ch.justdoit.andriodrpncalc.view;

import ch.justdoit.andriodrpncalc.model.Model;
import ch.justdoit.andriodrpncalc.model.command.EditCommand;
import ch.justdoit.andriodrpncalc.model.command.SwapCommand;
import ch.justdoit.andriodrpncalc.view.buttons.*;
import android.content.Context;
import android.widget.AbsoluteLayout;

public class KeyBaseCommands extends AbsoluteLayout{
	private Model model;
	
	public int WIDTH = 90;
	public int HEIGHT = 120;
	
	public KeyBaseCommands(Context context,  Model _model) {
		super(context);
		model = _model;
		
        int x = 0;
        int y = 0;

        ButtonCommand btnEdit = new ButtonCommand(context, model, new EditCommand(model));
        btnEdit.setTextSize((float) (0.4 * btnEdit.HEIGHT));
        
		addView(btnEdit, 
    			new AbsoluteLayout.LayoutParams(btnEdit.WIDTH, btnEdit.HEIGHT, x, y)
    	);
		x = x + btnEdit.WIDTH;

		ButtonCommand btnSwap = new ButtonCommand(context, model, new SwapCommand(model));
		addView(btnSwap, 
    			new AbsoluteLayout.LayoutParams(btnSwap.WIDTH, btnSwap.HEIGHT, x , y)
    	);
		x = x + btnSwap.WIDTH;
		
		ButtonUndo btnUndo = new ButtonUndo(context, model);
		addView(btnUndo, 
    			new AbsoluteLayout.LayoutParams(btnUndo.WIDTH, btnUndo.HEIGHT, x , y)
    	);
		x = x + btnUndo.WIDTH;
		
		ButtonEnter btnEnter = new ButtonEnter(context, model);
		addView(btnEnter, 
    			new AbsoluteLayout.LayoutParams(btnEnter.WIDTH, btnEnter.HEIGHT, x , y)
    	);
		x = x + btnEnter.WIDTH;

		ButtonCancel btnCancel = new ButtonCancel(context, model);
		addView(btnCancel, 
    			new AbsoluteLayout.LayoutParams(btnCancel.WIDTH, btnCancel.HEIGHT, x , y)
    	);
		x = x + btnCancel.WIDTH;
		y = y + btnCancel.HEIGHT;
		
		WIDTH = x;
		HEIGHT = y;
	}
	
	

}
